package com.systemsjr.jrenterprise.customer;

import com.systemsjr.jrenterprise.customer.vo.CustomerSearchCriteria;
import com.systemsjr.jrenterprise.utils.ServiceUtils;
import com.systemsjr.jrlib.richclient.BaseItemFilterForm;
import com.systemsjr.jrlib.richclient.table.JRTableUtils;

public class CustomerFilterForm extends
		BaseItemFilterForm<CustomerSearchCriteria> {

	public CustomerFilterForm() {
		super("customerFilterForm");
	}

	@Override
	protected void doSearch() {
		commit();
		CustomerSearchCriteria criteria = (CustomerSearchCriteria) getFormObject();
		JRTableUtils.refreshTable(table, ServiceUtils.getCustomerService().search(criteria));
	}

	@Override
	protected void doCreateFormControl() {
		
		builder.row();
		builder.add("name");
		builder.row();
		builder.add("phoneNumber");
		builder.row();
	}

	@Override
	protected Object newFormObject() {
		CustomerSearchCriteria criteria = new CustomerSearchCriteria();
		
		return criteria;
	}
}
